﻿function addFavouriteSong(id) {
    $("#functionSongRegion").hide(100);
    $("#functionSongRegionLoading").show(100);
    $.ajax(
        {
            type: "POST",
            url: "/Song/AddFavouriteSong",
            data: { songId: id },
            success: function (result) {
                $("#functionSongRegionLoading").hide(100);
                $("#functionSongRegion").show(100);
                $.msgbox(result.Message, { type: "info" });
            }
        });
}

function unAddFavouriteSongs(id) {
    $.msgbox("Are you sure that you want to permanently delete the selected element?", {
        type: "info",
        buttons: [
          { type: "submit", value: "Yes" },
          { type: "submit", value: "No" },
        ]
    }, function (result) {
        if (result == "Yes") {
            $.ajax(
                {
                    type: "POST",
                    url: "/Song/UnAddFavouriteSongs",
                    data: { songId: id },
                    success: function (result) {
                        $.msgbox(result.Message, { type: "info" });
                        location.reload();
                    }
                });
        }
    });
}

function searchFavouriteSong() {
    keyword = $("#inputTitleSearch").val()
    location.href = "/UserManagement/MyFavouriteSongs/1/" + keyword;
}

function gotoFavouritePage(page) {
    location.href = "/UserManagement/MyFavouriteSongs/" + page + "/" + keyword;
}

function jumpToPage(page) {
    location.href = "/UserManagement/MyFavouriteSongs/"+page+"/" + keyword;
}